package testGameLogic;

import static org.junit.Assert.*;

import java.util.ArrayList;

import org.junit.Before;
import org.junit.Test;

import YAPserver.gameObjects.Point;
import YAPserver.gameObjects.GameWall;
import YAPserver.logic.Field;
import YAPserver.logic.Output;

public class TestFieldCreation {
	private Field myField;
	private int numOfSides;
	private boolean isRegular;
	private int radius;
	private ArrayList<Point> corners = new ArrayList<Point>();
	private ArrayList<GameWall> walls = new ArrayList<GameWall>();
	
	@Before
	public void setup() throws Exception{
		this.numOfSides = 4;
		this.isRegular = true;
		this.myField = new Field(numOfSides, new Output());
		this.radius = myField.getRadius();
	}
	
	@Test
	public void testCreateRegField(){
		this.corners = myField.getCorners();
		this.walls = myField.getWalls();
		
		assertTrue(corners.get(0).toString().equals(2*radius + "\t" + radius));
		assertTrue(corners.get(1).toString().equals(radius + "\t" + 2*radius));
		assertTrue(corners.get(2).toString().equals("0\t" + radius));
		assertTrue(corners.get(3).toString().equals(radius + "\t0"));
		
		assertEquals(walls.get(0).toString(), 2*radius + "\t" + radius + "\t" + radius + "\t" + 2*radius);
		assertEquals(walls.get(3).toString(), radius + "\t0\t" +  2*radius + "\t" + radius);
	}
}
